package com.yiliao.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.yiliao.util.DateUtils;
import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yiliao.service.WeiXinPaySetUpService;
import com.yiliao.util.MessageUtil;
import com.yiliao.util.RedisUtil;

@Service("weiXinPaySetUpService")
public class WeiXinPaySetUpImpl extends ICommServiceImpl implements WeiXinPaySetUpService {

	@Autowired
	RedisUtil redisUtil;

	@Override
	public JSONObject getWeiXinPaySetUpList(int page) {
		try {

			String qSql = "SELECT w.*,p.t_pay_name FROM t_weixinpay_setup w LEFT JOIN t_pay_dispose p ON w.t_pay_id = p.t_id ";

			List<Map<String, Object>> dataMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(qSql);

			JSONObject json = new JSONObject();

			String cSql = "SELECT COUNT(t_id) AS total FROM t_weixinpay_setup";

			Map<String, Object> toMap = this.getFinalDao().getIEntitySQLDAO().findBySQLUniqueResultToMap(cSql);

			json.put("total", toMap.get("total"));
			json.put("rows", dataMap);

			return json;

		} catch (Exception e) {
			logger.error("获取微信支付设置异常!", e);
		}
		return null;
	}

	@Override
	public MessageUtil addOrUpWeiXinPaySetUp(Integer t_id, String appId, String t_mchid, String t_mchid_key,
			String t_certificate_url, int t_pay_id) {

		MessageUtil mu = null;
		try {
			
			if (null == t_id || 0 == t_id) {
				
				//获取当前传递的商户号是否已经存在了 
				List<Map<String,Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap("SELECT * FROM t_weixinpay_setup WHERE t_pay_id = ?",t_pay_id);
				
				if(null != sqltoMap && !sqltoMap.isEmpty()) {
					
					String mchid = sqltoMap.get(0).get("t_mchid").toString();
					if(!mchid.equals(t_mchid)) {
						return new MessageUtil(-1, "同一个支付配置不能配置多个支付key!");
					}
				}
				
				String inSql = " INSERT INTO t_weixinpay_setup (appId, t_mchid, t_mchid_key, t_pay_id,t_certificate_url) VALUES (?,?,?,?,?);";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(inSql, appId, t_mchid, t_mchid_key, t_pay_id,
						t_certificate_url);
			} else {
				String uSql = " UPDATE t_weixinpay_setup SET  appId=?, t_mchid=?, t_mchid_key=?, t_pay_id =?,t_certificate_url=? WHERE t_id= ? ; ";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(uSql, appId, t_mchid, t_mchid_key, t_pay_id,
						t_certificate_url, t_id);
			}

			// 覆盖redis中的数据
			redisUtil.hmset("pay_deploy_" + t_pay_id, new HashMap<String, String>() {
				private static final long serialVersionUID = 1L;
				{
					put("appId", appId);
					put("mchid", t_mchid);
					put("mchidKey", t_mchid_key);
				}
			});

			mu = new MessageUtil(1, "操作成功!");

		} catch (Exception e) {
			e.printStackTrace();
			logger.error("新增或修改异常!", e);
			mu = new MessageUtil(0, "");
		}
		return mu;
	}

	@Override
	public MessageUtil delWeiXinPaySetUp(int t_id) {
		MessageUtil mu = null;
		try {

			// 根据id得到支付配置Id
			Map<String, Object> toMap = this.getFinalDao().getIEntitySQLDAO()
					.findBySQLUniqueResultToMap("SELECT t_pay_id FROM t_weixinpay_setup WHERE t_id = ?", t_id);
			
			//删除缓存中的支付key
			redisUtil.remove("pay_deploy_" + toMap.get("t_pay_id"));

			String dSql = " DELETE FROM t_weixinpay_setup WHERE t_id = ? ";

			this.getFinalDao().getIEntitySQLDAO().executeSQL(dSql, t_id);

			mu = new MessageUtil(1, "操作成功!");

		} catch (Exception e) {
			e.printStackTrace();
			logger.error("删除微信支付设置异常!", e);
			mu = new MessageUtil(0, "程序异常!");
		}
		return mu;
	}

	@Override
	public MessageUtil getWxPayDeployList() {
		try {

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(
					"SELECT t_id,t_pay_name FROM t_pay_dispose WHERE t_pay_type in (-2,-5) AND t_is_scrap = 1");

			return new MessageUtil(1, sqltoMap);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public Object getAcePaySetUpList(int page) {
		try {

			String qSql = " SELECT al.t_id,al.t_alipay_appid,al.t_alipay_private_key,al.t_alipay_public_key,DATE_FORMAT(al.t_create_time,'%y-%m-%d %T') AS t_create_time,al.t_pay_id,p.t_pay_name FROM t_acepay_setup al LEFT JOIN t_pay_dispose p ON al.t_pay_id = p.t_id  ";

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(qSql);

			return JSONObject.fromObject(new HashMap<String, Object>() {
				private static final long serialVersionUID = 1L;
				{
					put("total", sqltoMap.isEmpty() ? 0 : 1);
					put("rows", sqltoMap);
				}
			});


		} catch (Exception e) {
			logger.error("获取ace支付设置异常!", e);
		}
		return null;
	}

	@Override
	public MessageUtil addOrUpAcePaySetUp(Integer t_id, String appId, String t_mchid, String t_mchid_key, String t_certificate_url, int t_pay_id) {
		MessageUtil mu = null;
		try {

			if (null == t_id || 0 == t_id) {

				//获取当前传递的商户号是否已经存在了
				List<Map<String,Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap("SELECT * FROM t_weixinpay_setup WHERE t_pay_id = ?",t_pay_id);

				if(null != sqltoMap && !sqltoMap.isEmpty()) {

					String mchid = sqltoMap.get(0).get("t_mchid").toString();
					if(!mchid.equals(t_mchid)) {
						return new MessageUtil(-1, "同一个支付配置不能配置多个支付key!");
					}
				}

				String inSql = " INSERT INTO t_weixinpay_setup (appId, t_mchid, t_mchid_key, t_pay_id,t_certificate_url) VALUES (?,?,?,?,?);";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(inSql, appId, t_mchid, t_mchid_key, t_pay_id,
						t_certificate_url);
			} else {
				String uSql = " UPDATE t_weixinpay_setup SET  appId=?, t_mchid=?, t_mchid_key=?, t_pay_id =?,t_certificate_url=? WHERE t_id= ? ; ";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(uSql, appId, t_mchid, t_mchid_key, t_pay_id,
						t_certificate_url, t_id);
			}

			// 覆盖redis中的数据
			redisUtil.hmset("pay_deploy_" + t_pay_id, new HashMap<String, String>() {
				private static final long serialVersionUID = 1L;
				{
					put("appId", appId);
					put("mchid", t_mchid);
					put("mchidKey", t_mchid_key);
				}
			});

			mu = new MessageUtil(1, "操作成功!");

		} catch (Exception e) {
			e.printStackTrace();
			logger.error("新增或修改异常!", e);
			mu = new MessageUtil(0, "");
		}
		return mu;
	}

	@Override
	public MessageUtil delAcePaySetUp(int t_id) {
		MessageUtil mu = null;
		try {

			// 根据id得到支付配置Id
			Map<String, Object> toMap = this.getFinalDao().getIEntitySQLDAO()
					.findBySQLUniqueResultToMap("SELECT t_pay_id FROM t_acepay_setup WHERE t_id = ?", t_id);

			//删除缓存中的支付key
			redisUtil.remove("pay_deploy_" + toMap.get("t_pay_id"));

			String dSql = " DELETE FROM t_acepay_setup WHERE t_id = ? ";

			this.getFinalDao().getIEntitySQLDAO().executeSQL(dSql, t_id);

			mu = new MessageUtil(1, "操作成功!");

		} catch (Exception e) {
			e.printStackTrace();
			logger.error("删除微信支付设置异常!", e);
			mu = new MessageUtil(0, "程序异常!");
		}
		return mu;
	}

	@Override
	public MessageUtil getAcePayDeployList() {
		try {

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(
					"SELECT t_id,t_pay_name FROM t_pay_dispose WHERE t_pay_type = -7 AND t_is_scrap = 1");

			return new MessageUtil(1, sqltoMap);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public MessageUtil setAcePaySetUp(Integer t_id, String t_alipay_appid, String t_alipay_private_key, String t_alipay_public_key, int t_pay_id) {
		try {
			// 新增
			if (t_id == null || t_id <= 0) {

				List<Map<String,Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap("SELECT t_alipay_public_key FROM t_acepay_setup WHERE t_pay_id =?", t_pay_id);

				if(null != sqltoMap && !sqltoMap.isEmpty()) {
					//取得公钥
					long count = sqltoMap.stream().filter(s -> !t_alipay_public_key.equals(s.get("t_alipay_public_key").toString())).count();

					if(count > 0) {
						return new MessageUtil(-1, "同一个支付配置不能配置多个不同的支付key!");
					}
				}

				String inSql = "INSERT INTO t_acepay_setup (t_alipay_appid, t_alipay_public_key, t_alipay_private_key,t_pay_id,t_create_time) VALUES (?, ?, ?, ?, ?);";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(inSql, t_alipay_appid.trim(),
						t_alipay_public_key.trim(), t_alipay_private_key.trim(), t_pay_id,
						DateUtils.format(new Date(), DateUtils.FullDatePattern));
			} else { // 修改

				String uSql = "UPDATE t_acepay_setup SET t_alipay_appid=?, t_alipay_public_key=?, t_alipay_private_key=?,t_pay_id = ? , t_create_time=? WHERE t_id=?; ";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(uSql, t_alipay_appid, t_alipay_public_key,
						t_alipay_private_key, t_pay_id, DateUtils.format(new Date(), DateUtils.FullDatePattern), t_id);
			}
			// 覆盖redis中的数据
			HashMap<String,String>obj = new HashMap<String, String>();
			obj.put("appId", t_alipay_appid);
			obj.put("publicKey", t_alipay_public_key);
			obj.put("privateKey", t_alipay_private_key);
			redisUtil.hmset("pay_deploy_" + t_pay_id, obj);

			return new MessageUtil(1, "更新成功!");

		} catch (Exception e) {
			e.printStackTrace();
			return new MessageUtil(0, "程序异常!");
		}
	}

	@Override
	public Object getSwapPaySetUpList(int page) {
		try {

			String qSql = " SELECT al.t_id,al.t_alipay_appid,al.t_alipay_private_key,al.t_alipay_public_key,DATE_FORMAT(al.t_create_time,'%y-%m-%d %T') AS t_create_time,al.t_pay_id,p.t_pay_name FROM t_swappay_setup al LEFT JOIN t_pay_dispose p ON al.t_pay_id = p.t_id  ";

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(qSql);

			return JSONObject.fromObject(new HashMap<String, Object>() {
				private static final long serialVersionUID = 1L;
				{
					put("total", sqltoMap.isEmpty() ? 0 : 1);
					put("rows", sqltoMap);
				}
			});


		} catch (Exception e) {
			logger.error("获取ace支付设置异常!", e);
		}
		return null;
	}

	@Override
	public MessageUtil setSwapPaySetUp(Integer t_id, String t_alipay_appid, String t_alipay_private_key, String t_alipay_public_key, int t_pay_id) {
		try {
			// 新增
			if (t_id == null || t_id <= 0) {

				List<Map<String,Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap("SELECT t_alipay_public_key FROM t_acepay_setup WHERE t_pay_id =?", t_pay_id);

				if(null != sqltoMap && !sqltoMap.isEmpty()) {
					//取得公钥
					long count = sqltoMap.stream().filter(s -> !t_alipay_public_key.equals(s.get("t_alipay_public_key").toString())).count();

					if(count > 0) {
						return new MessageUtil(-1, "同一个支付配置不能配置多个不同的支付key!");
					}
				}

				String inSql = "INSERT INTO t_swappay_setup (t_alipay_appid, t_alipay_public_key, t_alipay_private_key,t_pay_id,t_create_time) VALUES (?, ?, ?, ?, ?);";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(inSql, t_alipay_appid.trim(),
						t_alipay_public_key.trim(), t_alipay_private_key.trim(), t_pay_id,
						DateUtils.format(new Date(), DateUtils.FullDatePattern));
			} else { // 修改

				String uSql = "UPDATE t_swappay_setup SET t_alipay_appid=?, t_alipay_public_key=?, t_alipay_private_key=?,t_pay_id = ? , t_create_time=? WHERE t_id=?; ";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(uSql, t_alipay_appid, t_alipay_public_key,
						t_alipay_private_key, t_pay_id, DateUtils.format(new Date(), DateUtils.FullDatePattern), t_id);
			}
			// 覆盖redis中的数据
			HashMap<String,String>obj = new HashMap<String, String>();
			obj.put("appId", t_alipay_appid);
			obj.put("publicKey", t_alipay_public_key);
			obj.put("privateKey", t_alipay_private_key);
			redisUtil.hmset("pay_deploy_" + t_pay_id, obj);

			return new MessageUtil(1, "更新成功!");

		} catch (Exception e) {
			e.printStackTrace();
			return new MessageUtil(0, "程序异常!");
		}
	}

	@Override
	public MessageUtil delSwapPaySetUp(int t_id) {
		MessageUtil mu = null;
		try {

			// 根据id得到支付配置Id
			Map<String, Object> toMap = this.getFinalDao().getIEntitySQLDAO()
					.findBySQLUniqueResultToMap("SELECT t_pay_id FROM t_swappay_setup WHERE t_id = ?", t_id);

			//删除缓存中的支付key
			redisUtil.remove("pay_deploy_" + toMap.get("t_pay_id"));

			String dSql = " DELETE FROM t_swappay_setup WHERE t_id = ? ";

			this.getFinalDao().getIEntitySQLDAO().executeSQL(dSql, t_id);

			mu = new MessageUtil(1, "操作成功!");

		} catch (Exception e) {
			e.printStackTrace();
			logger.error("删除微信支付设置异常!", e);
			mu = new MessageUtil(0, "程序异常!");
		}
		return mu;
	}

	@Override
	public MessageUtil getSwapPayDeployList() {
		try {

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(
					"SELECT t_id,t_pay_name FROM t_pay_dispose WHERE t_pay_type = -8 AND t_is_scrap = 1");

			return new MessageUtil(1, sqltoMap);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public Object getHzfWeiXinPaySetUpList(int page) {
		try {

			String qSql = " SELECT al.t_id,al.t_alipay_appid,al.t_alipay_private_key,al.t_alipay_public_key,DATE_FORMAT(al.t_create_time,'%y-%m-%d %T') AS t_create_time,al.t_pay_id,p.t_pay_name FROM t_hzf_weixin_pay_setup al LEFT JOIN t_pay_dispose p ON al.t_pay_id = p.t_id  ";

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(qSql);

			return JSONObject.fromObject(new HashMap<String, Object>() {
				private static final long serialVersionUID = 1L;
				{
					put("total", sqltoMap.isEmpty() ? 0 : 1);
					put("rows", sqltoMap);
				}
			});


		} catch (Exception e) {
			logger.error("获取ace支付设置异常!", e);
		}
		return null;
	}

	@Override
	public MessageUtil setHzfWeiXinPaySetUp(Integer t_id, String t_alipay_appid, String t_alipay_private_key, String t_alipay_public_key, int t_pay_id) {
		try {
			// 新增
			if (t_id == null || t_id <= 0) {

				List<Map<String,Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap("SELECT t_alipay_public_key FROM t_hzf_weixin_pay_setup WHERE t_pay_id =?", t_pay_id);

				if(null != sqltoMap && !sqltoMap.isEmpty()) {
					//取得公钥
					long count = sqltoMap.stream().filter(s -> !t_alipay_public_key.equals(s.get("t_alipay_public_key").toString())).count();

					if(count > 0) {
						return new MessageUtil(-1, "同一个支付配置不能配置多个不同的支付key!");
					}
				}

				String inSql = "INSERT INTO t_hzf_weixin_pay_setup (t_alipay_appid, t_alipay_public_key, t_alipay_private_key,t_pay_id,t_create_time) VALUES (?, ?, ?, ?, ?);";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(inSql, t_alipay_appid.trim(),
						t_alipay_public_key.trim(), t_alipay_private_key.trim(), t_pay_id,
						DateUtils.format(new Date(), DateUtils.FullDatePattern));
			} else { // 修改

				String uSql = "UPDATE t_hzf_weixin_pay_setup SET t_alipay_appid=?, t_alipay_public_key=?, t_alipay_private_key=?,t_pay_id = ? , t_create_time=? WHERE t_id=?; ";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(uSql, t_alipay_appid, t_alipay_public_key,
						t_alipay_private_key, t_pay_id, DateUtils.format(new Date(), DateUtils.FullDatePattern), t_id);
			}
			// 覆盖redis中的数据
			HashMap<String,String>obj = new HashMap<String, String>();
			obj.put("appId", t_alipay_appid);
			obj.put("publicKey", t_alipay_public_key);
			obj.put("privateKey", t_alipay_private_key);
			redisUtil.hmset("pay_deploy_" + t_pay_id, obj);

			return new MessageUtil(1, "更新成功!");

		} catch (Exception e) {
			e.printStackTrace();
			return new MessageUtil(0, "程序异常!");
		}
	}

	@Override
	public MessageUtil delHzfWeiXinPaySetUp(int t_id) {
		MessageUtil mu = null;
		try {

			// 根据id得到支付配置Id
			Map<String, Object> toMap = this.getFinalDao().getIEntitySQLDAO()
					.findBySQLUniqueResultToMap("SELECT t_pay_id FROM t_hzf_weixin_pay_setup WHERE t_id = ?", t_id);

			//删除缓存中的支付key
			redisUtil.remove("pay_deploy_" + toMap.get("t_pay_id"));

			String dSql = " DELETE FROM t_hzf_weixin_pay_setup WHERE t_id = ? ";

			this.getFinalDao().getIEntitySQLDAO().executeSQL(dSql, t_id);

			mu = new MessageUtil(1, "操作成功!");

		} catch (Exception e) {
			e.printStackTrace();
			logger.error("删除微信支付设置异常!", e);
			mu = new MessageUtil(0, "程序异常!");
		}
		return mu;
	}

	@Override
	public MessageUtil getHzfWeiXinPayDeployList() {
		try {

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(
					"SELECT t_id,t_pay_name FROM t_pay_dispose WHERE t_pay_type = -9 AND t_is_scrap = 1");

			return new MessageUtil(1, sqltoMap);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public Object getHzfAliPaySetUpList(int page) {
		try {

			String qSql = " SELECT al.t_id,al.t_alipay_appid,al.t_alipay_private_key,al.t_alipay_public_key,DATE_FORMAT(al.t_create_time,'%y-%m-%d %T') AS t_create_time,al.t_pay_id,p.t_pay_name FROM t_hzf_ali_pay_setup al LEFT JOIN t_pay_dispose p ON al.t_pay_id = p.t_id  ";

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(qSql);

			return JSONObject.fromObject(new HashMap<String, Object>() {
				private static final long serialVersionUID = 1L;
				{
					put("total", sqltoMap.isEmpty() ? 0 : 1);
					put("rows", sqltoMap);
				}
			});


		} catch (Exception e) {
			logger.error("获取ace支付设置异常!", e);
		}
		return null;
	}

	@Override
	public MessageUtil setHzfAliPaySetUp(Integer t_id, String t_alipay_appid, String t_alipay_private_key, String t_alipay_public_key, int t_pay_id) {
		try {
			// 新增
			if (t_id == null || t_id <= 0) {

				List<Map<String,Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap("SELECT t_alipay_public_key FROM t_hzf_ali_pay_setup WHERE t_pay_id =?", t_pay_id);

				if(null != sqltoMap && !sqltoMap.isEmpty()) {
					//取得公钥
					long count = sqltoMap.stream().filter(s -> !t_alipay_public_key.equals(s.get("t_alipay_public_key").toString())).count();

					if(count > 0) {
						return new MessageUtil(-1, "同一个支付配置不能配置多个不同的支付key!");
					}
				}

				String inSql = "INSERT INTO t_hzf_ali_pay_setup (t_alipay_appid, t_alipay_public_key, t_alipay_private_key,t_pay_id,t_create_time) VALUES (?, ?, ?, ?, ?);";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(inSql, t_alipay_appid.trim(),
						t_alipay_public_key.trim(), t_alipay_private_key.trim(), t_pay_id,
						DateUtils.format(new Date(), DateUtils.FullDatePattern));
			} else { // 修改

				String uSql = "UPDATE t_acepay_setup SET t_alipay_appid=?, t_alipay_public_key=?, t_alipay_private_key=?,t_pay_id = ? , t_create_time=? WHERE t_id=?; ";
				this.getFinalDao().getIEntitySQLDAO().executeSQL(uSql, t_alipay_appid, t_alipay_public_key,
						t_alipay_private_key, t_pay_id, DateUtils.format(new Date(), DateUtils.FullDatePattern), t_id);
			}
			// 覆盖redis中的数据
			HashMap<String,String>obj = new HashMap<String, String>();
			obj.put("appId", t_alipay_appid);
			obj.put("publicKey", t_alipay_public_key);
			obj.put("privateKey", t_alipay_private_key);
			redisUtil.hmset("pay_deploy_" + t_pay_id, obj);

			return new MessageUtil(1, "更新成功!");

		} catch (Exception e) {
			e.printStackTrace();
			return new MessageUtil(0, "程序异常!");
		}
	}

	@Override
	public MessageUtil delHzfAliPaySetUp(int t_id) {
		MessageUtil mu = null;
		try {

			// 根据id得到支付配置Id
			Map<String, Object> toMap = this.getFinalDao().getIEntitySQLDAO()
					.findBySQLUniqueResultToMap("SELECT t_pay_id FROM t_hzf_ali_pay_setup WHERE t_id = ?", t_id);

			//删除缓存中的支付key
			redisUtil.remove("pay_deploy_" + toMap.get("t_pay_id"));

			String dSql = " DELETE FROM t_hzf_ali_pay_setup WHERE t_id = ? ";

			this.getFinalDao().getIEntitySQLDAO().executeSQL(dSql, t_id);

			mu = new MessageUtil(1, "操作成功!");

		} catch (Exception e) {
			e.printStackTrace();
			logger.error("删除微信支付设置异常!", e);
			mu = new MessageUtil(0, "程序异常!");
		}
		return mu;
	}

	@Override
	public MessageUtil getHzfAliPayDeployList() {
		try {

			List<Map<String, Object>> sqltoMap = this.getFinalDao().getIEntitySQLDAO().findBySQLTOMap(
					"SELECT t_id,t_pay_name FROM t_pay_dispose WHERE t_pay_type = -10 AND t_is_scrap = 1");

			return new MessageUtil(1, sqltoMap);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
